#include <cvirte.h>		
#include <userint.h>
#include "mytmp.h"

static int panelHandle;
double sheshi, huashi;
int main(int argc, char *argv[]) {
	if (InitCVIRTE(0, argv, 0) == 0)
		return -1; /* out of memory */
	if ((panelHandle = LoadPanel(0, "mytmp.uir", PANEL)) < 0)
		return -1;
	DisplayPanel(panelHandle);
	RunUserInterface();
	DiscardPanel(panelHandle);
	return 0;
}

int CVICALLBACK Startcallback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) {
	switch (event) {
		case EVENT_COMMIT:
		if(sheshi>=0&&sheshi<=100) {
			huashi=9*sheshi/5+32;
			SetCtrlVal (panelHandle, PANEL_huashi, huashi);
			SetCtrlVal (panelHandle, PANEL_LED,0);
		}
		else {
			huashi=9*sheshi/5+32;
			SetCtrlVal (panelHandle, PANEL_huashi, huashi);
			SetCtrlVal (panelHandle, PANEL_LED,1);
		}
		break;
	}
	return 0;
}

int CVICALLBACK Closecallback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) {
	switch (event) {
		case EVENT_COMMIT:
		QuitUserInterface (0);
		break;
	}
	return 0; }

int CVICALLBACK Sheshicallback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) {
	switch (event) {
		case EVENT_COMMIT:
		GetCtrlVal (panelHandle, PANEL_Sheshi, &sheshi);
		break;
	}
	return 0; }
